package com.yunhe.authority.repository.authority.impl;

import org.neo4j.ogm.model.Result;
import org.neo4j.ogm.session.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.*;

/**
 * 电站仓库自定义实现
 * @desc 电站仓库自定义实现
 * @author liuronglei
 */
@Repository
public class StationDao {

    @Autowired
    private Session session;

    /**
     * 执行语句查找站点
     * @param cypher 执行语句
     */
    public List<Map<String, Object>> search(String cypher) {
        Result result = session.query(cypher, new HashMap<>());
        Iterator<Map<String, Object>> iterator = result.iterator();
        List<Map<String, Object>> list = new ArrayList<>();
        while (iterator.hasNext()) {
            list.add(iterator.next());
        }
        return list;
    }
}
